﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Microsoft.Web.Mvc"%>
<asp:Content ID="paymentHead" ContentPlaceHolderID="head" runat="server">
    <title>Giỏ Hàng</title>
</asp:Content>
<asp:Content ID="css_js" ContentPlaceHolderID="js_css" runat="server">
    <script type="text/javascript" src="/scripts/jquery-1.4.2.min.js"></script>
</asp:Content>
<asp:Content ID="paymentContentLeft" ContentPlaceHolderID="left_content" runat="server">
       <div class="title"><span class="title_icon"><img src="/content/images/bullet1.gif" alt="" title="" /></span>Thanh Toán</div>
        	<div class="feat_prod_box_details">				
              	<div class="contact_form">
                <div class="form_subtitle">Tất cả thông tin phải đầy đủ</div>     
					<form action="/payment/PaymentSuccess" onsubmit = "return checkValidate();" method="post" id="payment" name="payment" >    
                    <div class="form_row">
                    <label class="contact" style="width:100px;"><strong>Tên người nhận:</strong></label>
                    <input type="text" class="contact_input" id = "name" name = "name" style ="width:200px" maxlength = "40"/>
                    </div>  

                    <div class="form_row">
                    <label class="contact"style="width:100px;"><strong>Email:</strong></label>
                    <input type="text" class="contact_input" id = "email" name = "email" style ="width:200px" maxlength = "30"/>
                    </div>


                    <div class="form_row">
                    <label class="contact"style="width:100px;"><strong>Số Điện Thoại:</strong></label>
                    <input type="text" class="contact_input" id ="phone" name = "phone" style ="width:200px" maxlength = "12"/>
                    </div>
                    
                    <div class="form_row">
                    <label class="contact"style="width:100px;"><strong>Địa Chỉ:</strong></label>
                    <input type="text" class="contact_input" id ="address" name = "address" style ="width:200px" maxlength = "100"/>
                    </div>

                 	 <% string[][] shippings = (string[][])ViewData["shippings"];%>
						   <% if (shippings != null && shippings.Length > 0)
            {%>   
                    <div class="form_row">
                    <label class="contact"style="width:100px;"><strong>Cách giao hàng:</strong></label>
						<select id="shipping_method" name = "shipping_method" style="width:200px;" >
						    <% foreach (string[] row in shippings)
             {%>
						      <option value="<% = row[0] %>"><% = row[1]%> : <% = row[2]%> VNĐ</option>
						   <% } %>
						</select>
                    </div>
                    <%} %>
                       
					                  
                     <% string[][] payments = (string[][])ViewData["payments"];%>
						   <% if (payments != null && payments.Length > 0)
            {%>
					<div class="form_row">
                    <label class="contact"style="width:100px;"><strong>Cách thanh toán:</strong></label>
      
						<select id="payment_method" name = "payment_method" style="width:200px;">
						
                           <% foreach (string[] row in payments)
                              {%>
						      <option value="<% = row[0] %>"><% = row[1]%></option>
						   <% } %>
						    
						</select>
                    </div>           
                    <%} %> 
                    <input id = "type_action" name = "type_action" type = "hidden" value = "<% = ViewData["type_action"] %>"/>  
                    <div class="form_row">
                     <input type="submit"  value="Gửi" class="register"/>
                     </div>
					</form>
                </div>  
                </div>
                <script type="text/javascript">
     function checkValidate() {
         if (document.getElementById("name").value == "") {
             alert('Vui lòng nhập tên người nhận');
             document.getElementById("name").focus();
             return false;
         }
         else if (document.getElementById("email").value == "") {
             alert('Vui lòng nhập email');
             document.getElementById("email").focus();
             return false;
         }
         else if (checkEmail(document.getElementById("email").value) != true) {
             alert('Email không hợp lệ');
             document.getElementById("email").focus();
             return false;
         }
         else if (document.getElementById("phone").value == "" || isNaN(document.getElementById("phone").value)) {
             alert("Số điện thoại chưa nhập hoặc chưa chính xác");
             document.getElementById("phone").focus();
             return false;
         }
         else if (document.getElementById("address").value == "") {
             alert('Bạn phải nhập địa chỉ');
             document.getElementById("address").focus();
             return false;
         }
         else {
                return true; 
            }
         
     }
     function checkEmail(value) {
         if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value))
             return true;
         else
             return false;
     }

</script>     
 <script type="text/javascript" src="/scripts/jquery.min.js"></script>  
</asp:Content>

<asp:Content ID="paymentContentRight" ContentPlaceHolderID="right_content" runat="server">
   <% Html.RenderAction("index", "sidebar"); %>
</asp:Content>
